﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace DataAccess
{
    public class FS0103DataAccess:FSBase_DataAccess
    {
        #region 检索
        public DataTable Search(string strCategory,string strRequirementNo)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.AppendLine("  select iAutoID,vcRequirementNo,vcCategory,vcRequirementName,vcRequirementDescription from tRequirement   ");
            strSql.AppendLine("  where 1=1   ");
            if (!string.IsNullOrEmpty(strCategory))
            {
                strSql.AppendLine("  and vcCategory = '" + strCategory + "'   ");
            }
            if (!string.IsNullOrEmpty(strRequirementNo))
            {
                strSql.AppendLine("  and vcRequirementNo like '" + strRequirementNo + "%'   ");
            }
            return Search(strSql.ToString());
        }
        #endregion

        #region 删除
        public void Delete(List<string> Items)
        {
            StringBuilder strSql = new StringBuilder();
            foreach (var item in Items)
            {
                strSql.AppendLine("   delete tRequirement where iAutoID = " + item + "  ");
            }
            update(strSql.ToString());
        }
        #endregion

        #region 获取需求种类列表
        public DataTable getCategoryList()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.AppendLine("   select distinct vcCategory from tRequirement where ISNULL(vcCategory,'')<>''  ");
            return Search(strSql.ToString());
        }
        #endregion
    }
}
